import React, { Component } from 'react'

export class Class extends Component {
    render() {
        const { classify, active } = this.props;
        return (
            <div>
                <ul className='tab'>
                    {
                        classify.map((item, index) => {
                            return <li
                                key={item.id}
                                className={index === active ? "on" : ""}
                                onClick={() => {
                                    console.log("111");
                                    this.setState({
                                        active: index
                                    })
                                }}
                            >

                            </li>
                        })
                    }
                </ul>
                <ol className='content'>
                    {
                        classify[active] ?
                            classify[active].children.map(item => {
                                return <li key={item.id}>
                                    <p><img src={item.img} alt="" /></p>
                                    <p>{item.title}</p>
                                </li>
                            }) : "暂无数据"
                    }
                </ol>
            </div>
        )
    }
}

export default Class